var _ = require('./../../../../FrameWork/we_underscore');
var BaseNode = require('./../../../../FrameWork/Component/BaseNode');
cc.Class(
{
    extends: BaseNode,

    properties:
    {
        rateRandVec2:
        {
            default: new cc.Vec2(1000, 2000),
            displayName: '发射频率随机区间[毫秒]'
        },

        isOnLoad: false,

        audioClip:
        {
            type: cc.AudioClip,
            default: null,
            displayName: '发射子弹声音'
        }
    },

    onLoad: function()
    {
        if (this.isOnLoad)
        {
            this.doStart();
        }
    },

    /**
     * _cycleTime:延时周期（单位毫秒）
     */
    doStart: function(_cycleTime, _nodeParent)
    {
        //子类自己实现
    },

    /**
     * 获取随机值
     */
    getRateRand()
    {
        return _.random(this.rateRandVec2.x, this.rateRandVec2.y);
    },

    /**
     * 切换频率
     */
    switchRate(_vec2)
    {
        this.rateRandVec2 = _vec2;
    },

    /**
     * 播放挂载音效
     */
    playSendAudio()
    {
        if (!!this.audioClip)
        {
            cc.audioEngine.play(this.audioClip, false, 0.5);
        }
    }
});